package cn.itcast.map;

import cn.itcast.bean.CleanBean;
import org.apache.flink.api.common.functions.RichMapFunction;

import java.math.BigDecimal;

/**
 * 深市数据转换-> CleanBean
 */
public class SzseMap extends RichMapFunction<String, CleanBean> {
    @Override
    public CleanBean map(String value) throws Exception {

        String[] arr = value.split("\\|");
        CleanBean bean = new CleanBean(
                arr[0].trim(),
                arr[1].trim(),
                arr[2].trim(),
                Long.valueOf(arr[3]),
                Long.valueOf(arr[4]),
                BigDecimal.valueOf(Double.valueOf(arr[5].trim())),
                BigDecimal.valueOf(Double.valueOf(arr[6].trim())),
                BigDecimal.valueOf(Double.valueOf(arr[7].trim())),
                BigDecimal.valueOf(Double.valueOf(arr[8].trim())),
                BigDecimal.valueOf(Double.valueOf(arr[9].trim())),
                Long.valueOf(arr[12].trim()),
                "szse");
        return bean;
    }
}
